﻿using BaseUtils.Utils;
using Service.src.Model.Folw;
using Service.src.NW.Model;
using System;

namespace Service.src.Base
{
    public class ComponentHelper
    {

   

        /// <summary>
        /// 获取组件
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public static FlowNode GetNode(int Id)
        {
            FlowNode Component = null;
            Model.Groupre groups = FileHelper.ReadContent<Model.Groupre>(AppDomain.CurrentDomain.BaseDirectory + AppData.NodeHubName);
            groups.Groups.ForEach(g => {
                g.items.ForEach(item => {
                    if (item.id == Id)
                    {
                        Component = item;
                        Component.Group = g.Group;
                    }
                });
            });
            return Component;
        }
    }
}
